#include <iostream>
#include <string>
#include <QWidget>
#include <QObject>
#include <QDialog>
#include <QStringListModel>

//the generated ui file here
#include "menu/menu.h"
//#include "cv.h"
#include "mythread.h"

class UiDialog : public QDialog,public Ui::Dialog{
   
    Q_OBJECT


    public:
        void openImage(QString);

        //the constructor setup the gui stuff here
        UiDialog(QWidget *parent=0) :  QDialog(parent){
            //call the stuff you need
            setupUi(this);
            //dont start
            startSurveilance = false;
            //make connections here
            connect(egit, SIGNAL(pressed()), this, SLOT(startEigenLearn()));
            connect(basla, SIGNAL(pressed()), this, SLOT(startVideoSurveilance()));
            connect(bitir, SIGNAL(pressed()), this, SLOT(stopVideoSurveilance()));
            //connect(bitir, SIGNAL(pressed()), &my, SLOT(turn_me_off()));
            connect(this,SIGNAL(stopProgram()),&my,SLOT(turn_me_off()));
        
            //connect the updating of the images !
            connect(&my,SIGNAL(reloadCropImage()),this,SLOT(updateCropImage()));
            connect(&my,SIGNAL(reloadFrameImage()),this,SLOT(updateFrameImage()));

            connect(&my,SIGNAL(sendMesageToMaster(QString)),this,SLOT(updateMesageBox(QString)));
            connect(&my,SIGNAL(sendDialogMessage(QString)),this,SLOT(showInformationDialog(QString)));

        //load the initial images here 
        openImage("crop");
        openImage("frame");
        }

    public slots:
        void startEigenLearn(); //called when we press to egit buton
        void startVideoSurveilance(); //called when pressed button start
        void stopVideoSurveilance();
        void updateMesageBox(QString childMesage); // when something interesting occurs in the child thread will send message here

    //private slots:
      //  void reloadFaceFrame();
      //  void reloadCameraFrame();


    signals:
      //  void loadedFaceFrame();
      //  void loadedCameraFrame();
      void stopProgram();

    private:
      //will change when buttons are pressed
      bool startSurveilance; 
      MyThread my;
    
    private slots:
        void  updateCropImage();
        void  updateFrameImage();
        void  showInformationDialog(QString);

};
